﻿@using TestSystem.Model;
@{

    Layout = "~/Views/Shared/_LayoutHUI.cshtml";
}



    <header class="hui-header">
        <div id="hui-back"></div>
        <h1>活动报名</h1>
    </header>




    <div class="hui-wrap">

        <div style="padding:10px;">
            <div class="hui-swipe" id="swipe">
                <div class="hui-swipe-items">
                    @if (ViewBag.RotationChart != null)
                    {
                        @foreach (var item in (List<RotationChart>)ViewBag.RotationChart)
                        {
                            <div class="hui-swipe-item"><img height="200px;" src="https://localhost:44300/api/_file/GetFile/@item.PhotoId" /></div>
                        }
                    }
                    else
                    {
                        <div class="hui-swipe-item"><img height="200px;" src="~/images/dqk.jpg" /></div>
                        <div class="hui-swipe-item"><img height="200px;" src="~/images/img1.jpg" /></div>
                        <div class="hui-swipe-item"><img height="200px;" src="~/images/img2.jpg" /></div>
                    }
                </div>
            </div>
        </div>

        <form style="padding:28px 10px;" class="hui-form" id="form1">

            <div class="hui-form-items">
                <div class="hui-form-items-title">姓名</div>
                <input type="text" name="username" class="hui-input" placeholder="请输姓名" />

            </div>
            <div class="hui-form-items">
                <div class="hui-form-items-title">单位</div>
                <input type="text" name="unitwork" class="hui-input" placeholder="请输入单位" />

            </div>

            <div style="padding:15px 8px;">
                <button type="button" class="hui-button hui-button-large hui-primary" id="submitBtn" style="margin-top:15px;">开始参与</button>
            </div>
        </form>

    </div>





@section Scripts{
    <script type="text/javascript" src="~/HUI-master/js/hui-form.js"></script>
    <script src="~/HUI-master/js/hui-swipe.js"></script>
    <script>
        var swipe = new huiSwpie('#swipe');
        swipe.autoPlay = true;
        swipe.run();
        hui('#submitBtn').click(function () {

            var data = hui.getFormData('#form1');

            if (data.username.length <= 0 || data.unitwork.length <= 0) {
                hui.alert('姓名或单位不能为空', '好的', function () {

                })
            } else {
                hui.alert('报名成功！', '好的', function () {
                    localStorage.setItem("username", data.username);
                    localStorage.setItem("unitwork", data.unitwork);
                    var id =  localStorage.getItem('hdid');
                    var href = '/AvoidTheLoginTest/GetTestPaper?id=' + id + '&&username=' + data.username + '&&unitwork=' + data.unitwork;
                    window.location.href = href;
                })
            }
        })



    </script>

}


